package com.java.vo;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.java.pojo.Cart;
import com.java.pojo.Product;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 返回购物车数据实体类
 */
@Data
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CartVo implements Serializable {
    public static final Long serialVersion = 1L;

    private Integer id;
    private Integer productID;
    private String productName;
    private String productImg;
    private double price;
    private Integer num;
    private Integer maxNum;
    private boolean check;

    public CartVo(Product product, Cart cart){
        this.id = cart.getId();
        this.productID = product.getProductId();
        this.productName = product.getProductName();
        this.productImg = product.getProductPicture();
        this.price = product.getProductSellingPrice();
        this.num = cart.getNum();
        this.maxNum = product.getProductNum();
        this.check = false;
    }


}
